package com.hu.zhcc.shiro.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hu.zhcc.common.entity.Page;
import com.hu.zhcc.shiro.dao.DeptDAO;
import com.hu.zhcc.shiro.dao.ResourceDAO;
import com.hu.zhcc.shiro.entity.bo.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("deptService")
public class DeptServiceImpl implements DeptService{
    @Autowired
    private DeptDAO deptDAO;
    @Override
    public PageInfo<Dept> listAll(int pageNum , int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Dept> depts = deptDAO.listAll();
        PageInfo<Dept> deptPageInfo = new PageInfo<>(depts);
        return deptPageInfo;
    }

    @Override
    public int removeDept(int id) {
        return deptDAO.removeDept(id);
    }

    @Override
    public int updateDept(Dept dept) {
        return deptDAO.updateDept(dept);
    }
}
